//
//  DrawClickView.m
//  yaoyiyao
//
//  Created by bh on 16/11/21.
//  Copyright © 2016年 BH. All rights reserved.
//

#import "DrawClickView.h"
/** RGB颜色 */
#define BHColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
@interface DrawClickView ()

@end

@implementation DrawClickView

- (instancetype)initWithFrame:(CGRect)frame{

    self = [super initWithFrame:frame];
    if (self) {
        
        [self setupUI];
    }
    return self;

}
- (void)setupUI{
    
//    UIView * bgView = [[UIView alloc]init];
//    [self addSubview:bgView];
//    
//    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
//       
//        make.leading.equalTo(self).with.offset(15);
//        make.centerY.equalTo(self).with.offset(0);
//        make.size.mas_equalTo(CGSizeMake(270, 240));
//    }];
    
    //白色背景
    self.whiteView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 270, 190)];
    [self addSubview:self.whiteView];
    self.whiteView.backgroundColor = [UIColor whiteColor];
    self.whiteView.layer.cornerRadius = 5;
    self.whiteView.layer.masksToBounds = YES;
    
    
    //没钥匙
    self.jiangImgView = [[UIImageView alloc]init];
    [self.whiteView addSubview:self.jiangImgView];
    self.jiangImgView.image = [UIImage imageNamed:@"ico_key_no"];
    [self.jiangImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.whiteView);
        make.top.equalTo(self.whiteView).with.offset(0);
        make.size.mas_equalTo(CGSizeMake(50, 50));
    }];
    //tip
    self.tipLabel = [[UILabel alloc]init];
    [self.whiteView addSubview:self.tipLabel];
    self.tipLabel.text = @"未搜索到匹配的钥匙\n请到物业处申请";
    self.tipLabel.textColor = [UIColor grayColor];
    self.tipLabel.textColor = BHColor(51, 51, 51);
    self.tipLabel.numberOfLines = 2;
    self.tipLabel.textAlignment = NSTextAlignmentCenter;
    self.tipLabel.font = [UIFont systemFontOfSize:15];
    
    [self.tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.whiteView);
        make.centerY.equalTo(self.whiteView).with.offset(-10);
        make.size.mas_equalTo(CGSizeMake(260, 50));
    }];
    
    //抽奖
    self.drawButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.whiteView addSubview:self.drawButton];
    [self.drawButton setTitle:@"确定" forState:UIControlStateNormal];
    self.drawButton.backgroundColor = Theme_Color;
    self.drawButton.layer.cornerRadius = 5;
    self.drawButton.layer.masksToBounds = YES;
    self.drawButton.titleLabel.font = [UIFont systemFontOfSize:16];

    [self.drawButton mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.equalTo(self.whiteView).with.offset(0);
        make.bottom.equalTo(self.whiteView).with.offset(-20);
        make.size.mas_equalTo(CGSizeMake(110, 40));
    }];
    
    
    //弹出弹窗
    CCPActionSheetView *alertview = [[CCPActionSheetView alloc] initWithAlertView:self.whiteView];
    self.actionSheetView = alertview;
    alertview.viewAnimateStyle = ViewAnimateScale;
    
}
@end
